<!-- 种母历史记录 -->

<template>
  <div>
    配种日期:<el-date-picker
      style="width: 180px"
      v-model="form.start"
    ></el-date-picker
    >--
    <el-date-picker style="width: 180px" v-model="form.end"></el-date-picker>
    种母耳号：<el-select
      style="width: 100px"
      v-model="form.sleepInforId"
      placeholder="请选择"
    >
      <el-option
        v-for="item in eweData"
        :label="item.earNumber"
        :value="item.sleepInforId"
      />
    </el-select>
    <el-button type="danger" @click="getTableData()">查询</el-button>
  </div>
  <el-table
    :header-cell-style="{
      height: '100px',
      fontSize: '13px',
      color: 'black',
      backgroundColor: 'antiquewhite'
    }"
    :data="tableData"
    border
    style="width: 100%"
  >
    <el-table-column type="selection" />
    <el-table-column prop="seedMotherHistoryRecordId" label="序号" />
    <el-table-column prop="moEarNumber" label="种母耳号" />
    <el-table-column prop="matingDate" label="配种日期">
      <template v-slot="scope">
        {{ scope.row.matingDate.substring(0, 19).replace('T', ' ') }}
      </template>
    </el-table-column>
    <el-table-column prop="farEarNumber" label="种公耳号" />
    <el-table-column prop="pregnancyCheckDate" label="妊检日期">
      <template v-slot="scope">
        {{ scope.row.pregnancyCheckDate.substring(0, 19).replace('T', ' ') }}
      </template>
    </el-table-column>
    <el-table-column prop="pregnancyCheckResult" label="妊检结果" />
    <el-table-column prop="farrowingDate" label="分娩日期">
      <template v-slot="scope">
        {{ scope.row.farrowingDate.substring(0, 19).replace('T', ' ') }}
      </template>
    </el-table-column>
    <el-table-column prop="healthyLambsCount" label="健羔数" />
    <el-table-column prop="healthyL" label="健羔总重" />
    <el-table-column prop="weak_lambs_count" label="弱羔数" />
    <el-table-column prop="deformed_lambs_count" label="畸形数" />
    <el-table-column prop="stillborn_lambs_count" label="死胎数" />
    <el-table-column prop="mummified_lambs_count" label="木乃伊数" />
    <el-table-column prop="malformed_fetus_count" label="畸胎数" />
    <el-table-column prop="weanedDate" label="断奶日期">
      <template v-slot="scope">
        {{ scope.row.weanedDate.substring(0, 19).replace('T', ' ') }}
      </template>
    </el-table-column>
    <el-table-column prop="weanedQuantity" label="断奶只数" />
    <el-table-column prop="totalWeaningWeight" label="断奶窝数" />
    <el-table-column prop="weanedNum" label="当前胎次" />
    <el-table-column prop="createId" label="创建人" />
    <el-table-column prop="createTime" label="创建时间" />
    <el-table-column prop="updateId" label="修改人" />
    <el-table-column prop="updateTime" label="修改时间" />
    <el-table-column label="操作" />
  </el-table>
</template>

<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue';
import { ElMessage, ElMessageBox } from 'element-plus';
import axios from 'axios';

const tableData = ref([]);

const form = reactive({
  sleepInforId: '',
  start: '',
  end: ''
});

const getTableData = () => {
  axios
    .post(
      'http://localhost:5039/api/ProductionManagement/Handle/EweHistorySelect',
      {
        sleepInforId: form.sleepInforId || 0,
        start: form.start || '',
        end: form.end || ''
      }
    )
    .then((res) => {
      tableData.value = res.data.data;
    });
};
//获取耳号
const eweData = ref<any>([]);
const geteweData = () => {
  axios
    .get('http://localhost:5039/api/SleepBegin/SelectEarFeMale')
    .then((res) => {
      eweData.value = res.data.data;
    });
};

onMounted(() => {
  getTableData();
  geteweData();
});
</script>

<style scoped></style>
